
import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.UTFDataFormatException;

public class RecruitSortFlowbean implements WritableComparable<RecruitSortFlowbean> {
    private String jd_sub_type;//招聘岗位类型
    private long require_nums;//所需人数
    private long city;//所在城市
    public RecruitSortFlowbean(){
        super();
    }



//比较
    public int compareTo(RecruitSortFlowbean bean) {
        //核心比较
        int result;
        if(require_nums>bean.getRequire_nums()){
            result=-1;
        }else if (require_nums<bean.getRequire_nums()){
            result=1;
        }else {
            result=0;
        }
        return result;
    }
//序列化
    public void write(DataOutput out) throws IOException {
        out.writeUTF(jd_sub_type);
        out.writeLong(require_nums);
        out.writeLong(city);

    }
//反序列化
    public void readFields(DataInput dataInput) throws IOException{
        jd_sub_type= dataInput.readUTF();
        require_nums=dataInput.readLong();
        city=dataInput.readLong();
    }

    public String getJd_sub_type() {
        return jd_sub_type;
    }

    public void setJd_sub_type(String jd_sub_type) { this.jd_sub_type = jd_sub_type; }

    public long getRequire_nums() {
        return require_nums;
    }

    public void setRequire_nums(long require_nums) {
        this.require_nums = require_nums;
    }

    public long getCity() {
        return city;
    }

    public void setCity(long city) {
        this.city = city;
    }

    @Override
    public String toString() {
        return jd_sub_type +"\t"+ require_nums + "\t" + city ;
    }
}
